package model.commands.math;

import java.util.List;
import model.Environment;
import model.SyntaxErrorException;
import model.commands.Command;


/**
 * Name:
 * PRODUCT value1 value2
 * * value1 value2
 * 
 * Description:
 * returns product of value1 and value2
 * 
 * @author JLongley
 * @author Erick Gonzalez
 */
public class ProductCommand extends Command {

    @Override
    public int evaluate(Environment e) throws SyntaxErrorException {
        List<Command> myArguments = getArguments();
        int myProduct = 1;
        for (Command arg : myArguments) {
            myProduct *= arg.evaluate(e);
        }
        return myProduct;
    }
}
